export default class EventBus {
    static callbacks: any = {}

    static on(eventName: string, callback: Function) {
        this.callbacks[eventName] = callback
    }

    static publish(eventName: string, ...args: any[]) {
        if (this.callbacks[eventName]) {
            this.callbacks[eventName](...args)
        }
    }

    static off(eventName: string) {
        this.callbacks[eventName] = null
    }
}
